package org.eclipse.nebula;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class NebulaActivator implements BundleActivator {

	private static BundleContext bundleContext;

	public void start(BundleContext context) throws Exception {
		bundleContext = context;

	}

	public void stop(BundleContext context) throws Exception {
		bundleContext = null;

	}

	/**
	 * Return the bundle context for this bundle, or <code>null</code> if there
	 * is not one. (for instance if the bundle is not activated or we aren't
	 * running OSGi.
	 * 
	 * @return the bundle context or <code>null</code>
	 */
	public static BundleContext getBundleContext() {
		return bundleContext;
	}

	/**
	 * Return the Bundle object for JFace. Returns <code>null</code> if it is
	 * not available.
	 * 
	 * @return the bundle or <code>null</code>
	 */
	public static Bundle getBundle() {
		return bundleContext == null ? null : bundleContext.getBundle();
	}

}
